package com.example.demo.mq;

import javafx.scene.AmbientLight;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SenderA {
    @Autowired
    private AmqpTemplate amqpTemplate;
    public void send(String context){
        System.out.println("Context:"+context);
        //使用AmqpTemplate将消息发送到消息队列QueueHello中去
        this.amqpTemplate.convertAndSend("Queue1",context);

    }
}
